package com.easyattendance.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="TBL_TIMESLOT")
public class TimeSlot
{
	@Id
	@Column(name="time_slot_id",length=15,nullable=false)
	private String time_slot_id;
	
	//@Id
	@ManyToOne
	@JoinColumn(name="section_id")
	private Section section;
	

	@Column(name="start_time",nullable=false)
	private Date start_time;
	
	@Column(name="end_time",nullable=false)
	private Date end_time;
	
	@Column(name="lecture_minutes", length=3)
	private int lecture_minutes;
	
	@Column(name="recess1_time",nullable=false,length=3)
	private Date recess1_time;
	
	@Column(name="recess1_minutes",length=3,nullable=false)
	private int recess1_minutes;
	
	@Column(name="recess2_time",nullable=false)
	private Date recess2_time;
	
	@Column(name="recess2_minutes",length=3,nullable=false)
	private int recess2_minutes;

	public TimeSlot() {
		super();
	}
	
	public TimeSlot(String time_slot_id, Section section,
			Date start_time, Date end_time, int lecture_minutes,
			Date recess1_time, int recess1_minutes, Date recess2_time,
			int recess2_minutes) {
		super();
		this.time_slot_id = time_slot_id;
		this.section = section;
		this.start_time = start_time;
		this.end_time = end_time;
		this.lecture_minutes = lecture_minutes;
		this.recess1_time = recess1_time;
		this.recess1_minutes = recess1_minutes;
		this.recess2_time = recess2_time;
		this.recess2_minutes = recess2_minutes;
	}

	

	public String getTime_slot_id() {
		return time_slot_id;
	}

	public void setTime_slot_id(String time_slot_id) {
		this.time_slot_id = time_slot_id;
	}

	public Section getSection() {
		return section;
	}

	public void setSection(Section section) {
		this.section = section;
	}

	public Date getStart_time() {
		return start_time;
	}

	public void setStart_time(Date start_time) {
		this.start_time = start_time;
	}

	public Date getEnd_time() {
		return end_time;
	}

	public void setEnd_time(Date end_time) {
		this.end_time = end_time;
	}

	public int getLecture_minutes() {
		return lecture_minutes;
	}

	public void setLecture_minutes(int lecture_minutes) {
		this.lecture_minutes = lecture_minutes;
	}

	public Date getRecess1_time() {
		return recess1_time;
	}

	public void setRecess1_time(Date recess1_time) {
		this.recess1_time = recess1_time;
	}

	public int getRecess1_minutes() {
		return recess1_minutes;
	}

	public void setRecess1_minutes(int recess1_minutes) {
		this.recess1_minutes = recess1_minutes;
	}

	public Date getRecess2_time() {
		return recess2_time;
	}

	public void setRecess2_time(Date recess2_time) {
		this.recess2_time = recess2_time;
	}

	public int getRecess2_minutes() {
		return recess2_minutes;
	}

	public void setRecess2_minutes(int recess2_minutes) {
		this.recess2_minutes = recess2_minutes;
	}



	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((section == null) ? 0 : section.hashCode());
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		TimeSlot other = (TimeSlot) obj;
		if (section.equals(other.section)) {
			return true;
		}
		return false;
	}
	
	
	
}